import type {CategoryListModel} from './model/categoryModel'


/**
 * 此文件是用来发送请求，获取三级分类的接口函数文件
 */
// 1. 引入异步对象
import request from '@/utils/request'

// 2. 使用枚举定义接口
enum Api {
  getCategory1ListApi = '/admin/product/getCategory1',
  getCategory2ListApi = '/admin/product/getCategory2',
  getCategory3ListApi = '/admin/product/getCategory3'
}

/**
 * 3. 获取一级分类数据
 * @returns 
 */
export const reqGetCategory1ListData = () => {
  return request.get<any,CategoryListModel>(Api.getCategory1ListApi)
}


/**
 * 4.获取二级分类数据
 * 
 */
 export const reqGetCategory2ListData = (id: number) => {
  return request.get<any,CategoryListModel>(`${Api.getCategory2ListApi}/${id}`)
}


/**
 * 5.获取三级分类数据
 * 
 */
 export const reqGetCategory3ListData = (id: number) => {
  return request.get<any,CategoryListModel>(`${Api.getCategory3ListApi}/${id}`)
}
